<!--师带徒积分规则-->

<blockquote class="layui-elem-quote" style="font-size: 14px">师带徒积分规则
</blockquote>

<hr class="layui-bg-gray">
<form class="layui-form" action="" id="teacher_form">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label" style="width: 100px">年度内期满经考核合格出师的，师傅和徒弟各积</label>
            <div class="layui-input-inline" style="width: 120px;">
                <input type="text" name="integral" value="${integral}" autocomplete="off" class="layui-input" lay-verify="required|number">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" style="width: 100px">年度内同一师傅有多名徒弟的，师傅积分上限为</label>
            <div class="layui-input-inline" style="width: 120px;">
                <input type="text" name="integral" value="${integral}" autocomplete="off" class="layui-input" lay-verify="required|number">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block" style="margin-top: 20px;">

            <button class="layui-btn" lay-submit lay-filter="teacher_form">提交保存</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>



<template>
    <tr>
        <td><input type="text" name="networkTrainRules[].startHours" autocomplete="off" class="layui-input" lay-verify="required|number"></td>
        <td><input type="text" name="networkTrainRules[].endHours" autocomplete="off" class="layui-input" lay-verify="required|number"></td>
        <td><input type="text" name="networkTrainRules[].credit" autocomplete="off" class="layui-input" lay-verify="required|number"> </td>
        <td>
            <button type="button" class="btn btn-primary " onclick="deleteNetWorkRow($(this))">
                <i class="fa fa-trash-o"></i>
            </button>
        </td>
    </tr>
</template>

<script>
    $(function(){
        initNetworkTrain();
    });
    /**
     * 添加行
     */
    function addNetWorkRow() {
        var trSize = $("#network_body>tr").length + 1;
        $("tbody").append($("template").html().replace(/\[]/g,"["+trSize+"]"));
    }

    /**
     * 删除行
     */
    function deleteNetWorkRow($this) {
        $this.closest("tr").empty();
    }

    /**
     * 提交
     */
    function initNetworkTrain() {
        layui.use(['form'], function(){
            var form = layui.form;

            form.on('submit(teacher_form)', function(data){
                form.verify();
                $.ajax({
                    type: "POST",
                    url: 'integral/network_train_add',
                    data: data.field,
                    dataType: "json",
                    success: function(data){
                        Feng.success("保存成功!");
                    }
                });
                return false;
            });
        });
    }

</script>